<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
		xmlns:ice="http://www.icesoft.com/icefaces/component" 
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages id="messages" globalOnly="true" styleClass="message" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg"/>
    
    <ice:form id="facilityeditForm" styleClass="edit">
     <ice:panelGroup  id="editfacilityGroupId" styleClass="formBorderHighlight">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                  <td class="iceDatTblColHdr2">
			    <ice:outputText id="editTextBoxId" value="#{facilityHome.managed ? 'Edit' : 'Add'} facility"/>
                  </td>
              </tr>
          </table>

        <ice:panelGroup id="editPanelGroupId" styleClass="edit">		 



            <s:decorate id="addressDecoration" template="layout/edit.xhtml">
                <ui:define name="label">address</ui:define>
                        <ice:inputText id="addressId" 
			    partialSubmit="true"
                                   size="50"
                              maxlength="50"
                                  value="#{facilityHome.instance.address}">
                        </ice:inputText>
            </s:decorate>


            <s:decorate id="cityDecoration" template="layout/edit.xhtml">
                <ui:define name="label">city</ui:define>
                        <ice:inputText id="cityId" 
			    partialSubmit="true"
                                   size="30"
                              maxlength="30"
                                  value="#{facilityHome.instance.city}">
                        </ice:inputText>
            </s:decorate>


            <s:decorate id="countryDecoration" template="layout/edit.xhtml">
                <ui:define name="label">country</ui:define>
                        <ice:inputText id="countryId" 
			    partialSubmit="true"
                                   size="30"
                              maxlength="30"
                                  value="#{facilityHome.instance.country}">
                        </ice:inputText>
            </s:decorate>


            <s:decorate id="countyDecoration" template="layout/edit.xhtml">
                <ui:define name="label">county</ui:define>
                        <ice:inputText id="countyId" 
			    partialSubmit="true"
                                   size="30"
                              maxlength="30"
                                  value="#{facilityHome.instance.county}">
                        </ice:inputText>
            </s:decorate>



            <s:decorate id="descriptionDecoration" template="layout/edit.xhtml">
                <ui:define name="label">description</ui:define>
                <h:inputTextarea id="description"
                               cols="80"
                               rows="3"
                              value="#{facilityHome.instance.description}"/>
            </s:decorate>


            <s:decorate id="nameDecoration" template="layout/edit.xhtml">
                <ui:define name="label">name</ui:define>
                        <ice:inputText id="nameId" 
			    partialSubmit="true"
                       required="true"
                                   size="50"
                              maxlength="50"
                                  value="#{facilityHome.instance.name}">
                        </ice:inputText>
            </s:decorate>


            <s:decorate id="phoneDecoration" template="layout/edit.xhtml">
                <ui:define name="label">phone</ui:define>
                        <ice:inputText id="phoneId" 
			    partialSubmit="true"
                                   size="10"
                              maxlength="10"
                                  value="#{facilityHome.instance.phone}">
                        </ice:inputText>
            </s:decorate>


            <s:decorate id="priceRangeDecoration" template="layout/edit.xhtml">
                <ui:define name="label">priceRange</ui:define>
                        <ice:inputText id="priceRangeId"
			    partialSubmit="true"
                                    value="#{facilityHome.instance.priceRange}">
                        </ice:inputText>
            </s:decorate>


            <s:decorate id="stateDecoration" template="layout/edit.xhtml">
                <ui:define name="label">state</ui:define>
                        <ice:inputText id="stateId" 
			    partialSubmit="true"
                                   size="2"
                              maxlength="2"
                                  value="#{facilityHome.instance.state}">
                        </ice:inputText>
            </s:decorate>


            <s:decorate id="typeDecoration" template="layout/edit.xhtml">
                <ui:define name="label">type</ui:define>
                        <ice:inputText id="typeId" 
			    partialSubmit="true"
                       required="true"
                                   size="15"
                              maxlength="15"
                                  value="#{facilityHome.instance.type}">
                        </ice:inputText>
            </s:decorate>


            <s:decorate id="uriDecoration" template="layout/edit.xhtml">
                <ui:define name="label">uri</ui:define>
                <h:inputTextarea id="uri"
                               cols="80"
                               rows="3"
                              value="#{facilityHome.instance.uri}"/>
            </s:decorate>


            <s:decorate id="zipDecoration" template="layout/edit.xhtml">
                <ui:define name="label">zip</ui:define>
                        <ice:inputText id="zipId" 
			    partialSubmit="true"
                                   size="5"
                              maxlength="5"
                                  value="#{facilityHome.instance.zip}">
                        </ice:inputText>
            </s:decorate>
            <div style="clear:both">
                <span class="required">*</span> 
                required fields
            </div>
          </ice:panelGroup>
       </ice:panelGroup>
                  
       <div class="actionButtons">
        
            <h:commandButton id="savefacilityHome" 
                          value="Save" 
                         action="#{facilityHome.persist}"
                       disabled="#{!facilityHome.wired}"
                       rendered="#{!facilityHome.managed}"/>  
                          			  
            <h:commandButton id="updatefacilityHome" 
                          value="Save" 
                         action="#{facilityHome.update}"
                       rendered="#{facilityHome.managed}"/>
                        			  
            <h:commandButton id="deletefacilityHome" 
                          value="Delete" 
                         action="#{facilityHome.remove}"
                      immediate="true"
                       rendered="#{facilityHome.managed}"/>
                    
            <s:button id="donefacilityHome" 
                   value="Done"
             propagation="end"
                    view="/Facility.xhtml"
                rendered="#{facilityHome.managed}"/>
                
            <s:button id="cancelfacilityHome" 
                   value="Cancel"
             propagation="end"
                    view="/#{empty facilityFrom ? 'FacilityList' : facilityFrom}.xhtml"
                rendered="#{!facilityHome.managed}"/>
                
        </div>
        
    </ice:form>

 <ice:form id="form2facilityHome">  
        <ice:panelTabSet id="editPanelTabfacilityHomeId" styleClass="componentPanelTabSetLayout" style="margin-bottom:5px;margin-top:10px;">
 	<ice:panelTab id="editPanelTabcoursesId" label="courses">
        <div class="association" id="coursesChildren">
        
            <h:outputText value="There are no courses associated with this facility." 
	                     id="editcoursesTextId"
                       rendered="#{empty facilityHome.courses}"/>
           <ice:dataTable value="#{facilityHome.courses}" 
                           var="course" 
                      rendered="#{not empty facilityHome.courses}" 
                    rowClasses="rvgRowOne,rvgRowTwo"
			  columnClasses="allCols"
                            id="editcoursesTable">
                <ice:column id="editidId">
                    <f:facet name="header">id</f:facet>
                    <h:outputText id="editidTextId" value="#{course.id}"/>
                </ice:column>
                <ice:column id="editdescriptionId">
                    <f:facet name="header">description</f:facet>
                    <h:outputText id="editdescriptionTextId" value="#{course.description}"/>
                </ice:column>
                <ice:column id="editdesignerId">
                    <f:facet name="header">designer</f:facet>
                    <h:outputText id="editdesignerTextId" value="#{course.designer}"/>
                </ice:column>
                <ice:column id="editfairwaysId">
                    <f:facet name="header">fairways</f:facet>
                    <h:outputText id="editfairwaysTextId" value="#{course.fairways}"/>
                </ice:column>
                <ice:column id="editgreensId">
                    <f:facet name="header">greens</f:facet>
                    <h:outputText id="editgreensTextId" value="#{course.greens}"/>
                </ice:column>
                <ice:column id="editnameId">
                    <f:facet name="header">name</f:facet>
                    <h:outputText id="editnameTextId" value="#{course.name}"/>
                </ice:column>
                <ice:column id="editnumHolesId">
                    <f:facet name="header">numHoles</f:facet>
                    <h:outputText id="editnumHolesTextId" value="#{course.numHoles}"/>
                </ice:column>
                <ice:column id="editsignatureHoleId">
                    <f:facet name="header">signatureHole</f:facet>
                    <h:outputText id="editsignatureHoleTextId" value="#{course.signatureHole}"/>
                </ice:column>
                <ice:column id="edityearBuiltId">
                    <f:facet name="header">yearBuilt</f:facet>
                    <h:outputText id="edityearBuiltTextId" value="#{course.yearBuilt}"/>
                </ice:column>
                <ice:column id="editcourseId">
                    <f:facet name="header">action</f:facet>
                    <s:link view="/Course.xhtml" 
                              id="selectcourse" 
                           value="Select"
                     propagation="none">
                        <f:param name="courseId" 
                                value="#{course.id}"/>
                        <f:param name="courseFrom" value="Facility"/>
                    </s:link>
                </ice:column>
           </ice:dataTable>
      </div>
        <f:subview rendered="#{facilityHome.managed}" id="coursesId">
        <div class="actionButtons">
            <s:button id="addcourseId" 
                   value="Add course"
                    view="/CourseEdit.xhtml"
             propagation="none">
                 <f:param name="facilityId" 
                         value="#{facilityHome.instance.id}"/>
                 <f:param name="courseFrom" value="Facility"/>
            </s:button>
        </div>
        </f:subview>
    </ice:panelTab>
</ice:panelTabSet>
</ice:form>
</ui:define>

</ui:composition>



